<section class="content-header">
  <h1>
        专利业务
    </h1>
  <ol class="breadcrumb">
    <li><a ui-sref="dashboard"><i class="fa fa-dashboard"></i>我的面板</a></li>
    <li><a ui-sref="patent">列表</a></li>
    <li class="active">查看</li>
  </ol>
</section>
<section class="content">
  <form class="form-horizontal view-form" id="patent_form">
    <div class="detail-view-header-wrapper">
      <div class="box-footer detail-view-header" ui-scrollpoint ui-scrollpoint-enabled="true" ui-scrollpoint-class="fixed">
        <!-- <button type="button" class="btn btn-info" ui-sref="patent_edit({id: id})" ng-if="data.status == 0 || data.review_status == 0" ui-sref-opts="{reload:true}">修改</button> -->
        <button type="button" class="btn btn-info" ui-sref="patent_edit({id: id})" ui-sref-opts="{reload:true}">修改</button>
        <button type="button" class="btn btn-primary" ng-click="submitAudit()" ng-if="data.status == 0 || data.review_status == 0">提交审核</button>
        <button type="button" class="btn btn-primary" ng-click="reAudit()" ng-if="data.status >= 1 && data.order_status == 0 && userInfo.username=='admin'">反审核</button>
        <button type="button" class="btn btn-success" ng-click="passAuditF()" ng-if="data.status==1 && opers.indexOf(3) > -1">财务审核通过</button>
        <button type="button" class="btn btn-danger" ng-click="refuseAudit()" ng-if="data.status==1 && opers.indexOf(3) > -1">财务审核驳回</button>
        <button type="button" class="btn btn-success" ng-click="passAudit()" ng-if="data.status > 1 && data.status < 3 && opers.indexOf(4) > -1">提交审核通过</button>
        <button type="button" class="btn btn-danger" ng-click="refuseAudit()" ng-if="data.status > 1 && data.status < 3 && opers.indexOf(4) > -1">提交审核驳回</button>
        <button type="button" class="btn btn-success" ng-click="progress('p')" ng-if="data.status >= 3">进度反馈</button>
        <button type="button" class="btn btn-success" ng-click="progress('w')" ng-if="data.status >= 3">完善资料</button>
        <button type="button" class="btn btn-info" ui-sref="patent_timeline({id: data.id, name: 'patent', code: data.code, source: 'view'})"><span class="fa fa-clock-o"></span>日志</button>
        <a href="/print.html?m=patent&id={{id}}" class="btn btn-info" target="_blank">打印</a>
        <span>状态: </span>
        <span class="tooltip-author" ng-if="data.status != 4" ng-bind="getOrderStatus() + ' | ' + getReviewStatus()" ng-attr-title="{{getTitle(data)}}" style="cursor: default;"></span>
        <span ng-if="data.status == 4" ng-bind="'已完成 | ' + format(data.date_finish, 'YYYY-MM-DD')"></span>
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">客户基本信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-2 control-label">档案号</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.code">XM001</span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">订单类别</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.type"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">客户名称</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.customer_name"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.industry.length > 0">
          <label class="col-sm-2 control-label">行业类别</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.industry"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.province.length > 0">
          <label class="col-sm-2 control-label">所属省</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.province"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.city.length > 0">
          <label class="col-sm-2 control-label">所属市</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.city"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.county.length > 0">
          <label class="col-sm-2 control-label">所属县</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.county"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.customer_address.length > 0">
          <label class="col-sm-2 control-label">地址</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.customer_address"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.contact.length > 0">
          <label class="col-sm-2 control-label">联系人</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.contact"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.mobile.length > 0">
          <label class="col-sm-2 control-label">手机</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.mobile"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.tel.length > 0">
          <label class="col-sm-2 control-label">座机</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.tel"></span>
          </div>
        </div>
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">注册信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-2 control-label">专利名称</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.name"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">申请人</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.applicant"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">申请人地址</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.address"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">申请人证件号码</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.card_no"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">专利设计人</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.designer"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">专利类型</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.patent_type"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">专利用途</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.patent_purpose"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">注册方式</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.reg_mode"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">成交日期</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="format(data.date_transaction, 'YYYY-MM-DD')"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">成交金额</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.amount_transaction"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">成交币别</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.currency"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">其他事项</label>
          <div class="col-sm-8">
            <textarea class="form-control" rows="3" name="description" ng-model="data.description" readonly style="background:#fff;"></textarea>
          </div>
        </div>
        <!-- <div class="form-group">
          <label class="col-sm-2 control-label">年检时间</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="format(data.date_inspection, 'YYYY-MM-DD')"></span>
          </div>
        </div> -->
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">注册进度</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-2 control-label">专利进度</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="!!data.progress? (' ' + data.progress) : ' 无进度信息'"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">受理时间</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="format(data.date_accept, 'YYYY-MM-DD')"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">授权时间</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="format(data.date_empower, 'YYYY-MM-DD')"></span>
          </div>
        </div>
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">收款记录</h3>
        <div class="box-tools pull-right">
          <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
          </button>
        </div>
      </div>
      <div class="box-body table-responsive no-padding">
        <table class="table table-hover">
          <tbody>
            <tr>
              <th style="width: 10px">#</th>
              <th>付款人</th>
              <th>收款银行</th>
              <th>收款账号</th>
              <th>收款金额</th>
              <th>币别</th>
                  <th>汇率</th>
              <th>收款方式</th>
              <th>收款时间</th>
              <th>附件</th>
              <th>备注</th>
              <th class="opt-col">操作</th>
            </tr>
            <tr ng-repeat="item in incomes.items">
              <td ng-bind="($index+1)+'.'"></td>
              <td ng-bind="item.payer"></td>
              <td ng-bind="item.bank"></td>
              <td ng-bind="item.account"></td>
              <td ng-bind="item.amount"></td>
              <td ng-bind="item.currency"></td>
                  <td ng-bind="item.rate"></td>
              <td ng-bind="item.pay_way"></td>
              <td ng-bind="format(item.date_pay, 'YYYY-MM-DD')"></td>
              <td>
                <a href="{{item.attachment_url}}" target="_blank" ng-if="item.attachment_url.length">
                  <img ng-src="{{item.attachment_url}}" width="22" height="22">
                </a>
              </td>
              <td ng-bind="item.description"></td>
              <td class="opt-col">
                <a ng-if="data.status == 0" class="fa fa-pencil orange" ui-sref=".income_edit({tid: {{item.id}}})" ui-sref-opts="{location:false}" title="修改"></a>
                <a ng-if="data.status == 0" href="javascript:;" class="fa fa-trash-o red" ng-click="deleteIncome(item)" title="删除"></a>
                <a href="/print.html?m=patent_line&id={{item.id}}" target="_blank">打印</a>
              </td>
            </tr>
            <tr>
              <td></td>
              <td class="summary" colspan="2">
                <div>
                  <span>本币: </span>
                  <span class="num">人民币</span>
                </div>
                <div>
                  <span>应收款: </span>
                  <span class="num receivable" ng-bind="incomes.amount"></span>
                </div>
                <div>
                  <span>已收款: </span>
                  <span class="num received" ng-bind="incomes.total"></span>
                </div>
                <div>
                  <span>未收款: </span>
                  <span class="num balance" ng-bind="incomes.balance"></span>
                </div>
              </td>
              <td class="summary" colspan="2">
              </td>
              <td class="summary" colspan="7">
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="box-footer clearfix">
        <button type="button" class="btn btn-info" ui-sref=".income_add({source_name: 'patent', customer_id: data.customer_id})" ui-sref-opts="{location:false}">新增</button>
        <button type="button" class="btn btn-info" ng-click="printReceipt('new')">新增收据</button>
        <button type="button" class="btn btn-info" ng-click="printReceipt('print')">打印收据</button>
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">其他信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-2 control-label">客户归属</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.salesman"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">订单归属</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.creator"></span>
            <button type="button" class="btn btn-info" ng-if="userInfo.username=='admin'" ui-sref=".creator()" ui-sref-opts="{location:false}">修改</button>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">渠道商</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.trader_name"></span>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">供应商</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.supplier_name"></span>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">助理</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.assistant_name"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">年检客服<span class="required">*</span></label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.waiter_name"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">经理</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.manager_name"></span>
          </div>
        </div>
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">附件</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body table-responsive no-padding">
        <table class="table table-hover">
          <tbody>
            <tr>
              <th style="width: 10px">#</th>
              <th>名称</th>
              <th>附件</th>
              <th>上传时间</th>
              <th>备注</th>
              <th class="opt-col">操作</th>
            </tr>
            <tr ng-repeat="item in attachments">
              <td ng-bind="($index+1)+'.'"></td>
              <td ng-bind="item.name"></td>
              <td>
                <a href="{{item.attachment_url}}" target="_blank" ng-if="item.attachment_url.length">
                          点击查看
                      </a>
              </td>
              <td ng-bind="format(item.date_created, 'YYYY-MM-DD')"></td>
              <td ng-bind="item.description"></td>
              <td class="opt-col">
                <a href="javascript:;" class="fa fa-trash-o red" ng-click="deleteAttachment(item)" title="删除"></a>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="box-footer clearfix">
        <button type="button" class="btn btn-info" ui-sref=".attachment({source_name: 'patent', source_id: data.id})" ui-sref-opts="{location:false}">新增</button>
      </div>
    </div>
  </form>
</section>
<div ui-view="modal"></div>
<div ui-view="progress"></div>
<div ui-view="print"></div>
<div ui-view="attachment"></div>
